<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>iframe demo frame 1</title>
		<script src="pubsub-bridge.js"></script>
		<script>
			function init( PubSub ){
				var btn = document.getElementById('publish-thing');

				setPubSub( PubSub );
				console.log( 'frame 1 init - ', window.PubSub );

				PubSub.subscribe( 'hello-world', function( topic, data ){
					console.log('hello-world received at frame 1 - ', data );
				});

				btn.onclick = function(){					
					PubSub.publish( 'hello-world', 'from button in frame 1' );
				};				
			}
		</script>
	</head>
	<body>
		<p>frame1.html</p>
		<button id="publish-thing">Test</button>
	</body>
</html>